-- pixy
-- created by panyl
-- 地牢格子：小妖精

return {
    -- 自动战斗
    autoFight = function(grid)
        local dbase = DungeonM.query(grid.class, "dbase");
        if dbase.resued == TRUE then
            if not NewbieDungeonM.hasResuedPixy() then
                return false;
            end
        end

        local pos = grid:getPos();
        if NewbieDungeonM.hasResuedPixy() then
            -- 领奖
            return DungeonActionM.go("do_building_bonus", pos);
        else
            if math.random(1, 2) == 1 then
                -- 索要物品
                return DungeonActionM.go("do_building_bonus", pos);
            else
                -- 让她离开
                return DungeonActionM.go("rescue_pixy", pos);
            end
        end
        return false;
    end,
};
